home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 23 November 1998
- // Author: mt
- //
- // Procedure Name:
- // buildSetCharacterMenu
- //
- // Description:
- // build the menu used for quickly selecting the current character
- //
- // Input Arguments:
- // Name of the parent menu
- //
- // Return Value:
- // None.
- //
- proc int
- createCharacterMenuItem(string $character,
- string $currentCharacter,
- int $submenu)
- {
- int $characterRadioOn = false;
- $radioState = ( $character == $currentCharacter );
- if ( $radioState ) {
- $characterRadioOn = true;
- }
- $cmd = ( "setCurrentCharacters( { \"" + $character + "\" } )" );
- $annotation = ( "Set current character to " + $character );
-
- string $chmem[] = `character -q $character`;
- string $subcharacters[] = `ls -type character $chmem`;
- int $submenu = (size($subcharacters) > 0);
- menuItem -l $character -c $cmd -annotation $annotation -sm $submenu
- -radioButton $radioState;
- if ($submenu) {
- menuItem -l $character -c $cmd -annotation $annotation
- -radioButton $radioState;
- menuItem -d true;
- for ($sub in $subcharacters) {
- if (createCharacterMenuItem($sub,
- $currentCharacter,1)) {
- $characterRadioOn = true;
- }
- }
- setParent -m ..;
- }
- return $characterRadioOn;
- }
-
- global proc buildSetCharacterMenu( string $menu )
- {
- menu -edit -dai $menu;
- setParent -m $menu;
- int $characterRadioOn = false;
-
- // Get the list of top-level characters from the character partition
- //
- string $characters[] = `partition -query characterPartition`;
- string $currentCharacters[] = currentCharacters();
-
- // Determine if there is a single current character
- //
- string $currentCharacter = "";
- if ( size( $currentCharacters ) == 1 ) {
- $currentCharacter = $currentCharacters[0];
- }
-
- // Put in the "None" menu item
- //
- radioMenuItemCollection;
- int $radioState;
- $radioState = ( size( $currentCharacters ) == 0 );
- $cmd = "setCurrentCharacters( {} )";
- menuItem -l "None" -command "ClearCurrentCharacterList"
- -annotation "None: Clear current character list"
- -radioButton $radioState;
-
- // Put in another divider, but only if there are characters
- // to list in the top-level character section of the menu
- //
- if ( size( $characters ) > 0 ) {
- menuItem -d true;
- }
-
- // Put in the radio buttons for all of the top-level characters
- // in the scene
- //
- string $cmd, $annotation;
- for ( $character in $characters ) {
- if (createCharacterMenuItem($character,
- $currentCharacter, 0)) {
- $characterRadioOn = true;
- }
- }
-
- menuItem -d true;
-
- // Put in the special case item for multiple or sub characters selected
- //
- int $radioState = ( ( size( $currentCharacters ) > 0 ) && !$characterRadioOn );
- string $label, $annotation;
- if ( $radioState ) {
- if ( size( $currentCharacters ) > 1 ) {
- // There are multiple characters selected
- //
- $label = "Multiple";
- $annotation = "Multiple current characters set from the character editor";
- } else {
- // There is only one character selected, so it must be
- // a sub character
- //
- $label = "Sub Character";
- $annotation = "Sub character set from the character editor";
- }
- menuItem -l $label -radioButton true -annotation $annotation;
- }
- menuItem -l "Character Sets..." -c "characterEditor( true )"
- -annotation "Character Sets: Open character editor";
-
- }
-